<extend name="Public/layout"/>
<block name="head">
<link rel="stylesheet" href="__PUBLIC__css/register.css">
</block>

<block name="main">
    <div class="banner">
        <img src="__PUBLIC__images/register-banner-step2.png" alt="">
    </div>

    <div class="form">
        <div class="form-group">
            <input type="password" name="password" placeholder="请设置新的登录密码">
        </div>
        <div class="form-group">
            <input type="password" name="password_f" placeholder="请确认新的登录密码">
        </div>
    </div>

    <div class="btn-wrapper">
        <a href="javascript:" onclick="sub()">完成</a>
    </div>
</block>
<block name="js">
<script type="text/javascript">

    function sub(){
        // $.md5(password);
        var password = $('input[name="password"]').val()
        var password_f = $('input[name="password_f"]').val()
        var sid ="{$_GET['sid']}"
        if(password!=password_f){
            layer.open({
                content:"两次密码输入不一致！"
                ,skin: 'msg'
                ,time: 1 //2秒后自动关闭
            });
            }
        var password=$.md5(password);
        $.post('{:U("User/register_pass")}',{
            password:password,
            sid:sid,
        },function(res) {

                if(res.err==0){
                    var url = '/Home/User/reg_success'
                }else{
                    var url = '/Home/User/reg_error'
                }
                
                location.href=url;
                
        });
        
    }
</script>
</block>